#!/usr/bin/python
from sys import stdin
from networkx import graph, parse_graph6
from indexFunctions import *
from TopologicalIndex import TopologicalIndex
from GED1GroupGenerator import GED1GroupGenerator
from TreeThumbprintGenerator import TreeThumbprintGenerator
from GraphGroupMath import GraphGroupMath


topologicalIndexes = []
for function in [R, M1, M2, ABC, SCI, GA1, AZI, HI]:
    topologicalIndexes.append(TopologicalIndex(function))

treeThumbprintGenerator = TreeThumbprintGenerator()
ged1GroupGenerator = GED1GroupGenerator(treeThumbprintGenerator)

for graph6Graph in stdin:
    
    graphGroup = GraphGroupMath()
    graph = parse_graph6(graph6Graph.strip())
    for ged1Graph in ged1GroupGenerator.generateGED1GroupOld(graph):
        graphGroup.addGraph(ged1Graph) 
    
    for topologicalIndex in topologicalIndexes:
        tiValues = graphGroup.calculateTi(topologicalIndex)
        stdev = graphGroup.calculateStandardDeviation(topologicalIndex) if graphGroup.count() > 1 else float("NaN") 
        diffs = graphGroup.calculateTiDiffs(topologicalIndex, graph)
        print "%s\t%f %f %f" % (topologicalIndex.name(), stdev,max(diffs), topologicalIndex.value(graph) )